package lew.bing;

import nl.siegmann.epublib.domain.Book;
import nl.siegmann.epublib.domain.Resource;
import nl.siegmann.epublib.epub.EpubReader;
import org.junit.Test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

/**
 * Created by 刘国兵 on 2019/8/20.
 *
 * @author 刘国兵
 */
public class ReadEpub {

    @Test
    public void testRead() throws IOException {
        EpubReader epubReader = new EpubReader();
        Book book = epubReader.readEpub(new FileInputStream("雪洗天下.epub"));
        List<Resource> contents = book.getContents();
        for (Resource content : contents) {
            System.out.println(content.getHref());
            System.out.println(content.getTitle());
        }
    }

}
